package com.lpf.hotelsystem.controller;

import com.lpf.hotelsystem.pojo.RomReservation;
import com.lpf.hotelsystem.service.impl.RomReservationServiceImpl;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
import io.swagger.annotations.Api;

import javax.annotation.Resource;

/**
 * 客房预订信息实体表(RomReservation)表控制层
 *
 * @author makejava
 * @since 2025-01-18 19:19:58
 */
@RestController
@RequestMapping("romReservation")
@Api(value = "客房预订信息实体表(RomReservation)",tags = "客房预订信息实体表(RomReservation)接口API")
public class RomReservationController {
    /**
     * 服务对象
     */
    @Resource
    private RomReservationServiceImpl romReservationServiceImpl;

    /**
     * 一次性全部查询已经入住或预定入住的订单
     *
     * @return 查询结果
     */
    @GetMapping("/selectAllByStatus")
    public Map<String, Object> selectAllByStatus(Integer status) {
        return romReservationServiceImpl.selectAllByStatus(status);
    }

    /**
     * 分页查询
     *
     * @param romReservation 筛选条件
     * @param page        要查询第几页
     * @param limit       每页显示多少条
     * @return 查询结果
     */
    @GetMapping("/selectByLimit")
    public Map<String, Object> selectByLimit(RomReservation romReservation, @RequestParam int page, @RequestParam int limit) {
        return romReservationServiceImpl.selectByLimit(romReservation, page, limit);
    }

    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @GetMapping("/selectById")
    public Map<String, Object> selectById(@RequestParam Integer id) {
        return romReservationServiceImpl.selectById(id);
    }

    /**
     * 新增数据
     *
     * @param romReservation 实体
     * @return 新增结果
     */
    @PostMapping("/insert")
    public Map<String, Object> insert(@RequestBody RomReservation romReservation) {
        return romReservationServiceImpl.insert(romReservation);
    }

    /**
     * 编辑数据
     *
     * @param romReservation 实体
     * @return 编辑结果
     */
    @PutMapping("/updateById")
    public Map<String, Object> updateById(@RequestBody RomReservation romReservation) {
        return romReservationServiceImpl.updateById(romReservation);
    }

    /**
     * 删除数据
     *
     * @param id 主键
     * @return 删除是否成功
     */
    @DeleteMapping("/deleteById")
    public Map<String, Object> deleteById(@RequestParam Integer reservationId) {
        return romReservationServiceImpl.deleteById(reservationId);
    }

}

